<style>
#store table tr{height:30px; line-height:30px;}
#store .gridlist thead td input{height:22px; line-height:22px;}
</style>
    <div class="division">
        <form method="post" action="index.php?app=o2o&ctl=admin_store&act=save" id="store">
            <input type="hidden" name="org[org_id]" value="<{$org_info.org_id}>" />
            <input type="hidden" name="org[org_p_id]" value="<{$p_org_info.org_id}>" />
            <h5>基本信息</h5>
            <table border="0" cellspacing="0" cellpadding="0" class="gridlist">
            <thead>
            <tr>
              <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 门店编码：</td>
              <td><{if $org_info.org_no}><input type="hidden" name="org[org_no]" value="<{$org_info.org_no}>" /><{$org_info.org_no}><{else}><{input type='text&&required' name="org[org_no]" value=$org_info.org_no}><{/if}>
              <{help}><{t}>门店在系统中的唯一标识<{/t}><{/help}>
              </td>
            </tr>
            <tr>
              <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 名称：</td>
              <td><{input type="text&&required" size="32" name="org[org_name]" value=$org_info.org_name}>
              <{help}><{t}>门店在此系统需要显示的中文名称<{/t}><{/help}>
              </td>
            </tr>
            <{if $org_info.org_id || !$p_org_info.org_id}>
            <tr>
                <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 所属组织：</td>
                <td>
                    <{input type='organization' app='organization' name="org[org_parents_structure]" value=$org_info.org_parents_structure required="true" show='onlytree'}>
                    <{help}><{t}>如不做选择 视为最高级<{/t}><{/help}>
                </td>
            </tr>
            <{/if}>
            <tr>
                <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 状态：</td>
                <td>
                    <input type="radio" name='org[status]' value=1 <{if $org_info.status == 1}> checked<{/if}>>启用&nbsp;&nbsp;
                    <input type="radio" name='org[status]' value=2 <{if $org_info.status == 2}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>停用
                </td>
            </tr>
            <tr>
              <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 地区：</td>
              <td><{input type='region' app='eccommon' name="org[area]" value=$org_info.area vtype="area" }>
              <{help}><{t}>门店所在区域<{/t}><{/help}>
              </td>
            </tr>
            </thead>
            </table>
            <br/>

            <h5>扩展信息</h5>
            <table border="0" cellspacing="0" cellpadding="0" class="gridlist">
            <thead>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em>所属服务端：</td>
                  <td>
                    <{if $store_prop.server_id}>
                        <{foreach from=$serverList item=server}>
                            <{if $server.server_id == $store_prop.server_id}>
                              <{$server.name}>
                            <{/if}>
                        <{/foreach}>
                        <input type='hidden' name="store_prop[server_id]" value="<{$store_prop.server_id}>">
                    <{else}>
                        <{input type="select" vtype="required" name="store_prop[server_id]" rows=$serverList valueColumn=server_id labelColumn=name value=$store_prop.server_id }>
                    <{/if}>
                  <{help}><{t}>门店所属的服务端，对接webpos服务器通讯需要<{/t}><{/help}>
                  </td>
                </tr>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 地址：</td>
                  <td><input type="text" vtype="required" name="store_prop[addr]" size="50" value="<{$store_prop.addr}>"/>
                  <{help}><{t}>门店详细地址信息<{/t}><{/help}>
                  </td>
                </tr>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 邮编：</td>
                  <td><input type="text" vtype="required" id="zip" name="store_prop[zip]" size="6" maxlength="6" value="<{$store_prop.zip}>"/>
                  <{help}><{t}>门店所在区域的邮编<{/t}><{/help}>
                  </td>
                </tr>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 联系人：</td>
                  <td><input type="text" vtype="required" name="store_prop[contacter]" size="12" value="<{$store_prop.contacter}>"/>
                  <{help}><{t}>门店负责人<{/t}><{/help}>
                  </td>
                </tr>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap">固定电话：</td>
                  <td><input type="text" id="tel" name="store_prop[tel]" size="20" value="<{$store_prop.tel}>"/>
                  </td>
                </tr>
                <tr>
                  <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 手机：</td>
                  <td><input type="text" id="mobile" name="store_prop[mobile]" size="15" value="<{$store_prop.mobile}>"/>&nbsp;&nbsp;<b style="color:red; font-weight:normal;">注：手机号与固定电话必须选填一项！</b></td>
                </tr>
                <tr>
                    <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 经营模式：</td>
                    <td>
                        <input type="radio" name='store_prop[store_type]' value='self' <{if $store_prop.store_type == 'self'}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>自营&nbsp;&nbsp;
                        <input type="radio" name='store_prop[store_type]' value='join' <{if $store_prop.store_type == 'join'}> checked<{/if}>>加盟&nbsp;&nbsp;
                        <input type="radio" name='store_prop[store_type]' value='cooperation' <{if $store_prop.store_type == 'cooperation'}> checked<{/if}>>合营&nbsp;&nbsp;
                        <input type="radio" name='store_prop[store_type]' value='proxy' <{if $store_prop.store_type == 'proxy'}> checked<{/if}>>代理&nbsp;&nbsp;
                        <input type="radio" name='store_prop[store_type]' value='special' <{if $store_prop.store_type == 'special'}> checked<{/if}>>特殊&nbsp;&nbsp;
                        <input type="radio" name='store_prop[store_type]' value='other' <{if $store_prop.store_type == 'other'}> checked<{/if}>>其他
                    </td>
                </tr>
                <tr>
                    <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 自提：</td>
                    <td>
                        <input type="radio" name='store_prop[self_pick]' value=1 <{if $store_prop.self_pick == 1}> checked<{/if}>>支持&nbsp;&nbsp;
                        <input type="radio" name='store_prop[self_pick]' value=2 <{if $store_prop.self_pick == 2}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>不支持
                    </td>
                </tr>
                <tr>
                    <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 配送：</td>
                    <td>
                        <input type="radio" name='store_prop[distribution]' value=1 <{if $store_prop.distribution == 1}> checked<{/if}>>支持&nbsp;&nbsp;
                        <input type="radio" name='store_prop[distribution]' value=2 <{if $store_prop.distribution == 2}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>不支持
                    </td>
                </tr>
                <tr>
                    <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 门店售后：</td>
                    <td>
                        <input type="radio" name='store_prop[aftersales]' value=1 <{if $store_prop.aftersales == 1}> checked<{/if}>>支持&nbsp;&nbsp;
                        <input type="radio" name='store_prop[aftersales]' value=2 <{if $store_prop.aftersales == 2}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>不支持
                    </td>
                </tr>
                <tr>
                    <td width="20%" align="right" nowrap="nowrap"><em class="c-red">*</em> 订单回执确认：</td>
                    <td>
                        <input type="radio" name='store_prop[confirm]' value=1 <{if $store_prop.confirm == 1}> checked<{/if}>>需要&nbsp;&nbsp;
                        <input type="radio" name='store_prop[confirm]' value=2 <{if $store_prop.confirm == 2}> checked<{/if}> <{if !$org_info.org_id}>checked<{/if}>>不需要
                    </td>
                </tr>
            </thead>
            </table>
            <div class="table-action">
              <{button class="btn-primary" type="button" id="savestore" name="submit" label="提交"}>
            </div>
        </form>
    </div>


<script>

function is_phone(str){

	var partten = /^\d{1,4}-\d{7,8}(-\d{1,6})?$/;
    var partten1 = /^400\d{7}$/;
    if(partten.test(str) || partten1.test(str)){
		return true;
	}else{
		return false;
	}
}

function is_mobile(str){

	var partten = /^\d{8,15}$/;
	if(partten.test(str)){
		return true;
	}else{
		return false;
	}
}

$('savestore').addEvent('click',function(event){
	if ($('zip').value.length != "6"){
		   alert('请输入正确的邮编');
		   $('zip').focus();
		   return false;
    }
    //固定电话与手机必填一项
    var gd_tel,mobile;
    gd_tel = $('tel').value.replace(" ","");
    mobile = $('mobile').value.replace(' ','');
    if (!gd_tel && !mobile){
		   alert('固定电话与手机号码必需填写一项');
		   $('tel').focus();
		   return false;
    }
    if (gd_tel){
			if (is_phone(gd_tel) === false){
				alert('请填写正确的固定电话');
			    $('tel').focus();
			    return false;
			}
    }
    if (mobile){
		   if ( is_mobile(mobile) === false){
			    alert('请输入正确的手机号码');
			    $('mobile').focus();
			    return false;
		   }
		   if (mobile[0] == '0'){
			    alert('手机号码前请不要加0');
			    $('mobile').focus();
			    return false;
		   }
    }
    $('store').fireEvent('submit',new Event(event));
});

$('store').store('target',{
    onRequest:function(){
       $('savestore').set('disabled', 'true');
    },
    onComplete:function(jsontext){
       var json = Json.evaluate(jsontext);
       if (typeof(json.error) != 'undefined'){
           $('savestore').set('disabled', '');
       }else{
           $('savestore').set('disabled', 'true');
           $('store').getParent('.dialog').retrieve('instance').close();
       }
    }
});

</script>